package com.kai.Service;

import com.kai.Mapper.BookMapper;
import com.kai.Pojo.Books;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookServiceImp implements BookService {

    @Resource
    private BookMapper mapper;

    //set方法注入spring中管理
    public void setMapper(BookMapper mapper) {
        this.mapper = mapper;
    }

    public int addBook(Books books) {
        return mapper.addBook(books);
    }

    public int deleteBookById(int id) {
        return mapper.deleteBookById(id);
    }

    public int updateBook(Books books) {
        return mapper.updateBook(books);
    }

    public Books queryBookById(int id) {
        return mapper.queryBookById(id);
    }

    public List<Books> queryAllBook() {
        return mapper.queryAllBook();
    }

    public List<Books> queryBookName(String bookName) {
        return mapper.queryBookName(bookName);
    }
}
